Skip to content

Commit 40b2de0

Browse files
committed
include title of question when classifying
1 parent 9b27d62 commit 40b2de0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

kitsune/llm/questions/classifiers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def classify_question(question: "Question") -> dict[str, Any]:
3030

3131
product = question.product
3232
payload: dict[str, Any] = {
33+
"subject": question.title,
3334
"question": question.content,
3435
"product": product,
3536
"topics": get_taxonomy(

kitsune/llm/questions/prompt.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
{format_instructions}
7373
"""
7474

75+
USER_QUESTION = """
76+
# {subject}
77+
78+
{question}
79+
"""
80+
7581

7682
spam_parser = StructuredOutputParser.from_response_schemas(
7783
(
@@ -117,14 +123,14 @@
117123
spam_prompt = ChatPromptTemplate(
118124
(
119125
("system", SPAM_INSTRUCTIONS),
120-
("human", "{question}"),
126+
("human", USER_QUESTION),
121127
)
122128
).partial(format_instructions=spam_parser.get_format_instructions())
123129

124130

125131
topic_prompt = ChatPromptTemplate(
126132
(
127133
("system", TOPIC_INSTRUCTIONS),
128-
("human", "{question}"),
134+
("human", USER_QUESTION),
129135
)
130136
).partial(format_instructions=topic_parser.get_format_instructions())

0 commit comments

Comments
 (0)